API Documentation
Public Member Functions | Public Attributes | List of all members
nkWinUi::Color Class Referencefinal

Represents a color. More...

Public Member Functions

 Color ()
 
 Color (unsigned char red, unsigned char green, unsigned char blue)
 
 ~Color ()
 
Color getAssociateColor (float factor=1.5f) const
 
Color mix (const Color &other, float factor) const
 
Color getColorForDepth (unsigned int depth) const
 
Color operator* (float factor) const
 

Public Attributes

unsigned char _r
 The red component of the color, [0, 255].
 
unsigned char _g
 The green component of the color, [0, 255].
 
unsigned char _b
 The blue component of the color, [0, 255].
 

Detailed Description

Represents a color.

Constructor & Destructor Documentation

◆ Color() [1/2]

nkWinUi::Color::Color ( )

Default constructor.

◆ Color() [2/2]

nkWinUi::Color::Color ( unsigned char  red,
unsigned char  green,
unsigned char  blue 
)

Constructor.

Parameters
redThe red component of the color.
greenThe green component of the color.
blueThe blue component of the color.

◆ ~Color()

nkWinUi::Color::~Color ( )

Destructor.

Member Function Documentation

◆ getAssociateColor()

Color nkWinUi::Color::getAssociateColor ( float  factor = 1.5f) const

Returns the "associate" color.

Parameters
factorThe factor to apply to this color.
Returns
The "associate" color, after application of the factor.
Remarks
Depending on the luminance factor of the color, this can result in either a darker, or a lighter associated color.

◆ mix()

Color nkWinUi::Color::mix ( const Color other,
float  factor 
) const

Mixes with another color.

Parameters
otherThe color to mix with.
factorThe factor, [0.f, 1.f], between this color (0.f) and the other one (1.f).
Returns
The color mix requested.

◆ getColorForDepth()

Color nkWinUi::Color::getColorForDepth ( unsigned int  depth) const

Automatically creates the color associated to the color, to give a sense of "depth" within the interface.

Parameters
depthThe depth that should be associated to the color returned. Currently, between [0, 10].
Returns
The color expressed for given depth.

◆ operator*()

Color nkWinUi::Color::operator* ( float  factor) const

Overridden operator for fast scalar application.

Parameters
factorThe factor to multiply with.
Returns
The color with all of its component multiplied by the factor.

The documentation for this class was generated from the following file: